#pragma once

class WMReaderView : public QObject
{
    Q_OBJECT
public:
    WMReaderView();
public slots:
    void ConnectToDevice();    
    void DeviceConnected();

    void DisconnectFromDevice();
    void DeviceDisconnected();  

    void RetrieveFileSystem(QTreeWidgetItem *topItem);
    void FileSystemRetrieved(QTreeWidgetItem *topItem, std::vector <CE_FIND_DATA> *fileSystemItems);

    void RetrieveRegistryKeysList(QTreeWidgetItem *topItem);
    void RegistryKeysListRetrieved(QTreeWidgetItem *topItem, std::vector <registry_set::REGKEY> *registryKeys);

    void RetrieveRegistryKeyValues(QTreeWidgetItem* topItem, int);
    void RegistryKeyValuesRetrieved(std::vector <registry_set::REGKEYVALUE> *keyValues);

    void RetrieveDeviceInfo(QTreeWidgetItem *topItem);
    void DeviceInfoRetrieved(std::vector <device_info::DEVICEINFO> *deviceInfo);

    void ShowAboutWindow();
    void ShowErrorMessage(const QString &message);
    void ClearChildItems(QTreeWidgetItem *topItem);
    void ClearDeviceInfoItems(QTreeWidgetItem *topItem);
signals:
    void RequestConnectToDevice();
    void RequestDisconnectFromDevice();
    void RequestFileSystem(QTreeWidgetItem *topItem);
    void RequestRegistryKeysList(QTreeWidgetItem *topItem);
    void RequestRegistryKeyValues(QTreeWidgetItem *topItem);
    void RequestDeviceInfo();
private:
    QMainWindow *m_MainWindow;
    QMenuBar *m_MenuBar;
    QMenu *m_FileMenu;
    QMenu *m_HelpMenu;
    QAction *m_ConnectAction;
    QAction *m_DisconnectAction;
    QAction *m_ExitAction;
    QAction *m_AboutAction;
    QTabWidget *m_TabControl;
    QTreeWidget *m_FileSystemTree;
    QTreeWidget *m_RegistryTree;
    QTreeWidget *m_InfoTree;
    QTreeWidget *m_RegistryValuesList;
    QTreeWidgetItem *m_FileSystemTop;
    QTreeWidgetItem *m_RegistryTop;
    QTreeWidgetItem *m_InfoTop;
    QStatusBar *m_StatusBar;
    QLabel *m_ConnectStatus;
    QLabel *m_ConnectIcon;

    void CreateMainWindow();
    void CreateMenuBar();
    void CreateTabControl();
    void CreateFileSystemTab();
    void CreateRegistryTab();
    void CreateInfoTab();
    void CreateStatusBar();
    void CreateClientWindow();
    void ShowClientWindow();   
    void ShowPredefinedRegKeys();
    
    void SetConnected(bool connected);
};